/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkg_entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Oswaldo
 */
@Entity
@Table(name = "stop_tipoperac", catalog = "sisventas_db", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tipoperac.findAll", query = "SELECT t FROM Tipoperac t"),
    @NamedQuery(name = "Tipoperac.findByTopCodigo", query = "SELECT t FROM Tipoperac t WHERE t.topCodigo = :topCodigo"),
    @NamedQuery(name = "Tipoperac.findByTopDescri", query = "SELECT t FROM Tipoperac t WHERE t.topDescri = :topDescri")})
public class Tipoperac implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "top_codigo")
    private Integer topCodigo;
    @Size(max = 15)
    @Column(name = "top_descri")
    private String topDescri;
    @OneToMany(mappedBy = "topCodigo")
    private List<Artiserv> artiservList;

    public Tipoperac() {
    }

    public Tipoperac(Integer topCodigo) {
        this.topCodigo = topCodigo;
    }

    public Integer getTopCodigo() {
        return topCodigo;
    }

    public void setTopCodigo(Integer topCodigo) {
        this.topCodigo = topCodigo;
    }

    public String getTopDescri() {
        return topDescri;
    }

    public void setTopDescri(String topDescri) {
        this.topDescri = topDescri;
    }

    @XmlTransient
    public List<Artiserv> getArtiservList() {
        return artiservList;
    }

    public void setArtiservList(List<Artiserv> artiservList) {
        this.artiservList = artiservList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (topCodigo != null ? topCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tipoperac)) {
            return false;
        }
        Tipoperac other = (Tipoperac) object;
        if ((this.topCodigo == null && other.topCodigo != null) || (this.topCodigo != null && !this.topCodigo.equals(other.topCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return topDescri;
    }
    
}
